package com.huawei.appmarket.framework.widget;

import android.app.Activity;
import android.content.Context;
import com.huawei.appmarket.support.widget.tabhost.FragmentTabHost.d;
import huawei.widget.HwBottomNavigationView;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import o.cgo;
import o.cju;
import o.ckm;
import o.dgh;
import o.dgm;
import o.dji;
import o.Logger;
import o.ContentManager;
import o.CollectCheck;
import o.ety;

public class ColumnNavigator implements d {
    private static final String TAG = "ColumnNavigator";
    private List<ckm> columns = new ArrayList();
    private HwBottomNavigationView mBottomNavigationView;
    private final Context mContext;
    LinkedHashMap<Integer, dji> mCustomTabItemMap = new LinkedHashMap();
    private e mOnTabSelectedListener;

    public interface e {
        void ˏ(dji o_dji, ckm o_ckm);
    }

    public ColumnNavigator(Context context, HwBottomNavigationView hwBottomNavigationView) {
        this.mContext = context;
        this.mBottomNavigationView = hwBottomNavigationView;
    }

    public void setOnTabSelectedListener(e eVar) {
        this.mOnTabSelectedListener = eVar;
    }

    public List<ckm> getColumn() {
        return this.columns;
    }

    public int getColumnCount() {
        return this.columns.size();
    }

    public void clearNavi() {
        if (!CollectCheck.isEmpty(this.columns)) {
            this.columns.clear();
        }
        if (this.mCustomTabItemMap != null && !this.mCustomTabItemMap.isEmpty()) {
            this.mCustomTabItemMap.clear();
        }
    }

    public void addColumn(List<ckm> list) {
        for (ckm addColumn : list) {
            addColumn(addColumn, list.size());
        }
    }

    public void addColumn(ckm o_ckm, int i) {
        if (o_ckm != null) {
            o_ckm.ॱ(this.columns.size());
            this.columns.add(o_ckm);
            if (cju.ˏ(o_ckm.ˊ())) {
                dji o_dji = new dji(this.mContext, o_ckm, this.mBottomNavigationView);
                if (this.mCustomTabItemMap != null) {
                    this.mCustomTabItemMap.put(Integer.valueOf(o_ckm.ᐝ()), o_dji);
                }
            }
        }
    }

    public void onTabSelected(int i) {
        Logger.ˏ(TAG, "onPageSelected, index:" + i);
        ckm o_ckm = (ckm) this.columns.get(i);
        dji o_dji = (dji) this.mCustomTabItemMap.get(Integer.valueOf(i));
        if (!(this.mOnTabSelectedListener == null || o_dji == null)) {
            this.mOnTabSelectedListener.ˏ(o_dji, o_ckm);
        }
        ety.ˊ().ˋ(o_ckm.ˊ());
    }

    public void reportOper(int i) {
        ckm o_ckm;
        if (i < this.columns.size()) {
            o_ckm = (ckm) this.columns.get(i);
        } else {
            o_ckm = null;
        }
        if (o_ckm != null) {
            cgo.ˋ("1", o_ckm.ˊ(), dgm.ˎ((Activity) this.mContext));
            dgh.ॱ(ContentManager.getInstant().getContext().getApplicationContext(), "" + o_ckm.ॱ(), "01_" + o_ckm.ˊ());
        }
    }

    public void unregisterBroadCastCustomTabItem(int i) {
        if (this.mCustomTabItemMap != null) {
            dji o_dji = (dji) this.mCustomTabItemMap.get(Integer.valueOf(i));
            if (o_dji != null) {
                o_dji.ॱ();
            }
        }
    }
}
